package com.umgsai.thread.thread66;

public class Main1 {
	public static void main(String[] args) {
		System.out.println("当前线程名：" + Thread.currentThread().getName());
		System.out.println("所属线程组：" + Thread.currentThread().getThreadGroup().getName());
		System.out.println("线程组数量：" + Thread.currentThread().getThreadGroup().activeGroupCount());
		ThreadGroup group = new ThreadGroup("New-group");
		System.out.println("线程组数量：" + Thread.currentThread().getThreadGroup().activeGroupCount());
		ThreadGroup[] threadGroups = new ThreadGroup[Thread.currentThread().getThreadGroup().activeGroupCount()];
		Thread.currentThread().getThreadGroup().enumerate(threadGroups);
		for (int i = 0; i < threadGroups.length; i++) {
			System.out.println("第" + (i + 1) + "个线程组名字为:" + threadGroups[i].getName());
		}
		//如果实例化线程组时不指定所属的线程组，则实例化的线程组归到当前线程对象所属的线程组中
	}
}
